<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>添加外借物品登记</title>

		<link rel="stylesheet"
			href="<%=request.getContextPath()%>/css/common.css" type="text/css" />
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/interface/registerInfoTypeAction.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/engine.js'></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/dwr/util.js'></script>
		<script language="JavaScript" charset="gb2312"
			src="<%=request.getContextPath()%>/js/dmsutil.js"></script>
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/js/N13FormValidation-2.js"></script>
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/js/jquery-latest.pack.js'></script>			
		<script type='text/javascript'
			src='<%=request.getContextPath()%>/js/noConflictOfJquery.js'></script>
		<script type="text/javascript">		
	
		//window.onload=init;
		function init(){
			setRegisterInfoTypeList();
			tick();
		}
		/**
		* 给apart select框赋值的
		*/
				function setRegisterInfoTypeList() {
					registerInfoTypeAction.getAllRegisterInfoType(ritCallBack);
				}
				var ritCallBack = function setList(ritList)//回调函数
				{				
					var s=$("registerInfoTypeName");
					DWRUtil.removeAllOptions(s); 
					s.options[0] = new Option("请选择物品类型",'0');
					for ( var i = 1; i < ritList.length+1; i++) {
						var opt = new Option(ritList[i-1].registerinfotypename,
								ritList[i-1].registerinfotypeid);
						s.options[i] = opt;
					}
				}
				/**
				* 公寓select框change函数
				*/
				function selectChange(){
					
				}
				
				function checkOnSubmit(){
					var studentNo=window.top.frames['apt'].frames['maintain'].document.getElementById("student_info").value;
					document.getElementById("studentno").value=studentNo;
					var selectedIndex=dwr.util.getValue("registerInfoTypeName");
					if(""==studentNo){
						alert("请输入学号！！");
						return false;
					}else if(0==selectedIndex){
						alert("请选择物品类型！！");
						return false;
					}else{
						return true;
					}
				}
				
		</script>


	</head>

	<body>
		<div id="page_container">
			<jsp:include page="registerinfonav.jsp"></jsp:include>
			<h2>
				借用物品登记
			</h2>
			<!-- 引入学生基本信息页面 -->
			<s:form id="mainform" action="registerinfo/insertregisterinfo.action"
				method="post" theme="simple" onsubmit="return checkOnSubmit()">
				<table class="table_common">
					<s:hidden id="studentno" name="ri.registuserstudentno" />
					<tr>
						<td class="td_left">
							*所借物品类型：
						</td>
						<td class="td_right">
							<select class="common_select"
								name="ri.registerinfotype.registerinfotypeid"
								id="registerInfoTypeName" style="width: 120"
								onchange="javascript:selectChange();">
							</select>
						</td>
					</tr>
					<tr>
						<td class="td_left">
							*物品借出时间：
						</td>
						<td class="td_right">
							<label id="Clock"></label>
						</td>
					</tr>
					<tr class="table_submit">
						<td colspan="2">
							<input class="common_button" type="submit" value="提交" />
						</td>
					</tr>
				</table>
			</s:form>
			<script type="text/javascript">
				window.onload = function(){
						var nav_a=$j('#page_nav a');
						var nav_span=$j("#page_nav a span");
						for(var u = 0 ;u<nav_a.length;u++){
								nav_a.get(u).style.backgroundPosition="left top";
								nav_span.get(u).style.backgroundPosition="right top";							
						}
						$j('#page_nav a').get(0).style.backgroundPosition="0% -42px";
						$j("#page_nav a span").get(0).style.backgroundPosition="100% -42px";	
						
						init();
				}
			</script>
		</div>
	</body>
</html>